﻿<UserControl 
    x:Class="FU.Capstones.IMS.Web.Silverlight.Views.UserInfo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    xmlns:Navigation="clr-namespace:Navigation.Silverlight;assembly=Navigation.Silverlight" 
    xmlns:TControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    xmlns:Controls1="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
	xmlns:Controls="clr-namespace:FU.Capstones.IMS.Web.Silverlight.Controls" 
	Navigation:ViewModel.TypeName="FU.Capstones.IMS.Web.Silverlight.ViewModels.UserInfoViewModel"
    >
    
    <telerik:RadBusyIndicator
        BusyContent="Đang kết nối tới máy chủ..."
        IsBusy="{Binding Path=ServiceCallCounter, Converter={StaticResource IntegerToBoolConverter}}"
        >
        <Grid x:Name="LayoutRoot" Style="{StaticResource ViewGridStyle}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
            </Grid.RowDefinitions>
            <!--Title-->
            <Grid Grid.ColumnSpan="3">
                <Grid.Background>
                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                        <GradientStop Color="{StaticResource OuterColor}" Offset="{StaticResource ControlBackgroundGradientStop0}"/>
                        <GradientStop Color="{StaticResource InnerColor}" Offset="{StaticResource ControlBackgroundGradientStop1}"/>
                        <GradientStop Color="{StaticResource InnerColor}" Offset="{StaticResource ControlBackgroundGradientStop2}"/>
                        <GradientStop Color="{StaticResource OuterColor}" Offset="{StaticResource ControlBackgroundGradientStop3}"/>
                    </LinearGradientBrush>
                </Grid.Background>

                <TextBlock 
                    x:Name="lblTitle" 
                    Style="{StaticResource TextBlockTitlePageStyle}"                   
                    Text="Thông tin người dùng"/>
            </Grid>
            
            <TControls:RadTabControl                
                Grid.Row="2"  Grid.Column="0" Grid.ColumnSpan="3"
                Background="Transparent"
                >
                <TControls:RadTabItem
                    Header="Thông tin chung"
                    Background="Transparent"
                    >
                    <!--Input data field-->
                    <Grid x:Name="InputField">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <!--Username-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Column="1" Grid.Row="0"
                            >
                            <Run Text="{StaticResource UsernameLabelText}" />
                            
                        </TextBlock>

                        <TextBox 
                            x:Name="txtUserName" 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="0"
                            Text="{Binding Path=Employee.Username,Mode=TwoWay}"
                        />

                        <!--Name-->
                        <TextBlock
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Column="1" Grid.Row="1">
                            <Run Text="{StaticResource EmployeeLabelText}" />
                            
                        </TextBlock>

                        <TextBox 
                            x:Name="txtEmployeeName"
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="1"
                            Text="{Binding Path=Employee.FullName,Mode=TwoWay}"
                    
                            />

                        <!--BirthDate-->
                        <TextBlock
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Column="1" Grid.Row="2">
                            <Run Text="{StaticResource DateOfBirthLabelText}" />                            
                        </TextBlock>

                        <TextBox 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="2"
                            Text="{Binding Path=Employee.DateOfBirth,Mode=TwoWay}"
                    
                            />
                        <!--Gender-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}" 
                            Grid.Column="1" Grid.Row="3">
                            <Run Text="{StaticResource GenderLabelText}" />
                            
                        </TextBlock>

                        <TextBox 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="3"
                            Text="{Binding Path=Employee.Gender,Mode=TwoWay}"
                    
                            />

                        <!--So CMND-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Column="1" Grid.Row="4">
                            <Run Text="{StaticResource IdentityCardNumberLabelText}" />
                            
                        </TextBlock>

                        <TextBox 
                            x:Name="txtIdentityCardNumber" 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="4"
                            Text="{Binding Path=Employee.IdentityCardNumber,Mode=TwoWay}"
                            />

                        <!--Address-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}" 
                            Grid.Column="1" Grid.Row="5">
                            <Run Text="{StaticResource AddressLabelText}" />
                            
                        </TextBlock>

                        <TextBox
                            x:Name="txtAddress" 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="5"
                            Text="{Binding Path=Employee.Address,Mode=TwoWay}"
                        />

                        <!--Role-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}" 
                            Grid.Column="1" Grid.Row="6" >
                            <Run Text="{StaticResource RoleLabelText}" />
                            
                        </TextBlock>

                        <TextBox 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="6"
                            Text="{Binding Path=Employee.Role.RoleName,Mode=TwoWay}"
                    
                            />
                        <!--EmploymentType-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}" 
                            Grid.Column="1" Grid.Row="7" >
                            <Run Text="{StaticResource EmploymentTypeLabelText}" />
                            
                        </TextBlock>

                        <TextBox 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="7"
                            Text="{Binding Path=Employee.EmploymentType.EmploymentTypeName,Mode=TwoWay}"
                    
                            />
                        
                        <!--JoinedDate-->
                        <TextBlock
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Column="1" Grid.Row="8">
                            <Run Text="{StaticResource JoinedDateLabelText}" />                            
                        </TextBlock>

                        <TextBox 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="8"
                            Text="{Binding Path=Employee.JoinedDate,Mode=TwoWay}"
                    
                            />
                        <!--Email-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}" 
                            Grid.Column="1" Grid.Row="9"
                            Text="{StaticResource EmailLabelText}" />

                        <TextBox 
                            x:Name="txtEmail" 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="9"
                            Text="{Binding Path=Employee.Email,Mode=TwoWay}"
                        />

                        <!--Home phone-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Column="1" Grid.Row="10" 
                            Text="{StaticResource PhoneNumberLabelText}"/>

                        <TextBox 
                            x:Name="txtHomePhone" 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="10"
                            Text="{Binding Path=Employee.PhoneNumber,Mode=TwoWay}"
                        />

                        <!--Mobile-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}" 
                            Grid.Column="1" Grid.Row="11" 
                            Text="{StaticResource MobileNumberLabelText}"/>

                        <TextBox 
                            x:Name="txtMobile" 
                            Style="{StaticResource TextBoxReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="11"
                            Text="{Binding Path=Employee.MobileNumber,Mode=TwoWay}"
                        />

                        <!--Comment-->
                        <TextBlock 
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Column="1" Grid.Row="12"
                            Text ="{StaticResource BriefDescriptionLabelText}"/>

                        <TextBox 
                            x:Name="txtComment" 
                            Style="{StaticResource TextBoxMultilineReadOnlyStyle}"
                            Grid.Column="2" Grid.Row="12"
                            Text="{Binding Path=Employee.Description, Mode=TwoWay}"
                        />

                    </Grid>

                </TControls:RadTabItem>

                <TControls:RadTabItem
                    Header="Tác vụ"
                    Background="Transparent">
                    <Controls1:RadGridView
                        telerik:StyleManager.Theme="Office_Black"
                        Style="{StaticResource RadGridViewNormal}"
                        ItemsSource="{Binding Path=AuthorizationCollection}"
                        >
                        <Controls1:RadGridView.Columns>
                            <Controls1:GridViewColumn
                                Header="Chọn">
                                <Controls1:GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox
                                            HorizontalAlignment="Center"
                                            IsChecked="{Binding Path=IsSelected, Mode=OneWay}"
                                            IsEnabled="False"
                                        />
                                    </DataTemplate>
                                </Controls1:GridViewColumn.CellTemplate>
                            </Controls1:GridViewColumn>
                            <Controls1:GridViewDataColumn 
                                Header="Tác vụ" 
                                DataMemberBinding="{Binding Path=Description}"
                                />
                        </Controls1:RadGridView.Columns>
                    </Controls1:RadGridView>
                </TControls:RadTabItem>

                <TControls:RadTabItem
                    Header="Đổi mật khẩu"
                    Background="Transparent"
                    >
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="10"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        
                        <!--OldPassword-->
                        <TextBlock
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Row="0" Grid.Column="1"
                            >
                            <Run Text="{StaticResource OldPasswordLabelText}"/>
                            <Run Text="*" Foreground="Red" />
                        </TextBlock>
                        
                        <PasswordBox
                            Style="{StaticResource PasswordBoxNormalStyle}"
                            Grid.Row="0" Grid.Column="2"
                            Password="{Binding Path=NewPasswordData.CurrentPassword, Mode=TwoWay, ValidatesOnDataErrors=True}"
                            />

                        <!--NewPassword-->
                        <TextBlock
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Row="1" Grid.Column="1"
                            >
                            <Run Text="{StaticResource NewPasswordLabelText}"/>
                            <Run Text="*" Foreground="Red" />
                        </TextBlock>

                        <PasswordBox
                            Style="{StaticResource PasswordBoxNormalStyle}"
                            Grid.Row="1" Grid.Column="2"
                            Password="{Binding Path=NewPasswordData.NewPassword, Mode=TwoWay, ValidatesOnDataErrors=True}"
                            />

                        <!--NewPasswordConfirm-->
                        <TextBlock
                            Style="{StaticResource TextBlockNormalStyle}"
                            Grid.Row="2" Grid.Column="1"
                            >
                            <Run Text="{StaticResource NewPasswordConfirmLabelText}"/>
                            <Run Text="*" Foreground="Red" />
                        </TextBlock>

                        <PasswordBox
                            Style="{StaticResource PasswordBoxNormalStyle}"
                            Grid.Row="2" Grid.Column="2"
                            Password="{Binding Path=NewPasswordData.NewPasswordConfirmed, Mode=TwoWay, ValidatesOnDataErrors=True}"
                            />
                        
                        <StackPanel
                            Orientation="Horizontal"
                            Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4"
                            HorizontalAlignment="Center"
                            >
                            <Controls:SaveButtonControl />

                            <Controls:BackButtonControl />
                        </StackPanel>
                    </Grid>
                </TControls:RadTabItem>

            </TControls:RadTabControl>

            <TextBlock
                Grid.Row="4" Grid.Column="0" HorizontalAlignment="Center" Grid.ColumnSpan="3"
                Style="{StaticResource ErrorMessageTextBlockStyle}"
                Text="{Binding Path=Message, Mode=TwoWay}"
                Visibility="{Binding Path=ErrorMessageVisibility, Mode=TwoWay}"
            />

            <TextBlock
                Grid.Row="4" Grid.Column="0" HorizontalAlignment="Center" Grid.ColumnSpan="3"
                Style="{StaticResource SuccessfulMessageTextBlockStyle}"
                Text="{Binding Path=Message, Mode=TwoWay}"
                Visibility="{Binding Path=MessageVisibility, Mode=TwoWay}"
            />
        </Grid>
    </telerik:RadBusyIndicator>
</UserControl>
